<template>
  <div>
    <el-dialog title="提示" v-model="dialogVisible" width="30%">
      <el-form :model="form">
        <el-form-item label="惩罚金额" :label-width="120">
          <el-input v-model="form.money" autocomplete="off" />
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="handleClose">确 定</el-button>
        </span>
      </template>
    </el-dialog>
    <div class="data-content1">

      <el-table v-loading="loading" :data="tableData.list"   @sort-change="changeTableSort"
                style="width: 100%;font-size: 12px;">
        <el-table-column label="投递人" prop="creatorName" width="100">
        </el-table-column>
        <el-table-column label="性别" prop="sex" width="100">
        </el-table-column>
        <el-table-column label="电话" prop="phone" width="100">
        </el-table-column>
        <el-table-column label="微信号" prop="wxNo" width="100">
        </el-table-column>
        <el-table-column label="报名状态" prop="joinState" width="100" sortable="custom">
          <template #default="scope">
            {{scope.row.joinStateName}}
          </template>
        </el-table-column>
        <el-table-column label="活动城市" prop="cityName" width="100">
        </el-table-column>
        <el-table-column label="投递日期" prop="addDate">
        </el-table-column>
        <el-table-column width="185" align="center" fixed="right" label="操作">
          <template #default="scope">
            <el-button text size="small" class="operation_bt" :icon="Edit" type="info" @click="showMiss(scope.row)">放鸽子
            </el-button>
            <el-button text size="small" class="operation_bt" :icon="Edit" type="info" @click="showView(scope.row)">详情
            </el-button>

            <el-button text size="small" class="operation_bt" :icon="Edit" type="info" @click="showDaka(scope.row)">打卡详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <div class="page">
        <el-pagination background :current-page="searchObject.no" :page-sizes="[10, 20, 50, 100]"
                       :page-size="tableData.size" :pager-count="5" layout="total, sizes, prev, pager, next, jumper"
                       :page-count="tableData.totalPage" :total="tableData.total" @size-change="sizeChange"
                       @current-change="pageChange">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import common from "@/mixins/common.js";

export default {
  name: "view_join",
  mixins: [common],
  data() {
    return {
      searchObject: {
        no: 1,
        size: 10,
        creator: '',
        creatorName: '',
        sortField:"joinState",
        sortMethod:	"desc"
      },
      dialogVisible: false,
      defaultProps: {
        children: 'children',
        label: 'name'
      },
      loading: false,
      tableData: {},
      selectId:"",
      form:{
        money:"",
        id:""
      }
    }
  },
  mounted() {
    let id = this.$route.query.id;
    this.searchObject.topic = id;
    this.searchObject.searchType = "admin";
    this.getSearchList();
  },
  methods: {
    async getSearchList() {
      this.loading = true;
      let data = this.searchObject;
      let res = await this.$http.form("/tenantRest/topicjoin/search.htm", data);
      this.loading = false;
      if (res.code === 0) {
        this.tableData = res;
      }
    },
    showMiss(row){
      this.form.id=row.id;
      this.dialogVisible=true;
      console.info(this.selectId)
    },
    showView(row){

      this.$router.push({
        path: '/model/view',
        query: {
          id: row.creator,
          activeIndex: 1,
          time: Math.random()
        }
      })
       console.info(row.creator)
    },
    showDaka(row){
      this.$router.push({
        path: '/topic/join_shop',
        query: {
          topicJoin: row.id,
          activeIndex: 1,
          time: Math.random()
        }
      })
    },
   async handleClose(){
      let data = this.form;
      let res = await this.$http.form("/tenantRest/topicjoin/missing.htm", data);
      this.dialogVisible = false;
      if (res.code === 200) {
        this.$message({
          message: '操作成功',
          type: 'success'
        });
      }else{
        this.$message.error(res.msg);
      }
      this.dialogVisible=false;
    }
  },
}
</script>

<style scoped>

</style>
